﻿using System;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Metadata;

#nullable disable

namespace WebApplication2.Models.Database
{
    public partial class xinwenContext : DbContext
    {
        public xinwenContext()
        {
        }

        public xinwenContext(DbContextOptions<xinwenContext> options)
            : base(options)
        {
        }

        public virtual DbSet<Newlei> Newleis { get; set; }
        public virtual DbSet<Nr> Nrs { get; set; }

        protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
        {
            if (!optionsBuilder.IsConfigured)
            {
#warning To protect potentially sensitive information in your connection string, you should move it out of source code. You can avoid scaffolding the connection string by using the Name= syntax to read it from configuration - see https://go.microsoft.com/fwlink/?linkid=2131148. For more guidance on storing connection strings, see http://go.microsoft.com/fwlink/?LinkId=723263.
                optionsBuilder.UseSqlServer("Data Source=.;Initial Catalog=xinwen;Integrated Security=SSPI");
            }
        }

        protected override void OnModelCreating(ModelBuilder modelBuilder)
        {
            modelBuilder.HasAnnotation("Relational:Collation", "Chinese_PRC_CI_AS");

            modelBuilder.Entity<Newlei>(entity =>
            {
                entity.HasNoKey();

                entity.ToTable("newlei");

                entity.Property(e => e.Id)
                    .HasMaxLength(10)
                    .HasColumnName("ID")
                    .IsFixedLength(true);

                entity.Property(e => e.Xinwenlei)
                    .HasMaxLength(10)
                    .HasColumnName("xinwenlei")
                    .IsFixedLength(true);
            });

            modelBuilder.Entity<Nr>(entity =>
            {
                entity.HasNoKey();

                entity.ToTable("nr");

                entity.Property(e => e.Biaoti)
                    .HasMaxLength(1150)
                    .HasColumnName("biaoti");

                entity.Property(e => e.Laiyuan).HasColumnName("laiyuan");

                entity.Property(e => e.Neir).HasColumnName("neir");

                entity.Property(e => e.Time)
                    .HasMaxLength(50)
                    .HasColumnName("time");
            });

            OnModelCreatingPartial(modelBuilder);
        }

        partial void OnModelCreatingPartial(ModelBuilder modelBuilder);
    }
}
